package cn.jja8.config.tool.work.obj.parameterized;

import java.util.List;
import java.util.stream.Collectors;

public class FieldAsList implements ParameterizedKeep<List> {

    @Override
    public List in(Object con, TypeKeep[] typeKeeps) throws Throwable {
        return (List) ((List) con).stream().map(o -> typeKeeps[0].in(o)).collect(Collectors.toList());
    }

    @Override
    public Object out(List list, TypeKeep[] typeKeeps) throws Throwable {
        return list.stream().map(o -> typeKeeps[0].out(o)).collect(Collectors.toList());
    }
}
